import axios from 'axios'
import {baseURL} from '../configFile'
import UserInfo from '../types/UserInfo'
import UserType from "../types/UserType";

const axiosReq = axios.create({
    baseURL
})


export const queryUserInfo = (id: number) => {
    return axiosReq.get('/queryUserInfo', { params: { id } })
}

export const modifyUserInfo = (info:Pick<UserInfo, 'ID'> & Partial<Pick<UserInfo, 'password' | 'telephone' | 'email'>>) => {
    return axiosReq.post('/modifyUserInfo', info)
}

//超管添加用户
export const addUser = (userType: UserType,username:String,password:String,telephone:String,email:String) => {
    return axiosReq.post('/addUser', {userType,username,password,telephone,email })
}


export const searchUserInfo = (keyword:string) => {
    return axiosReq.get('/searchUser',{params:{keyword}})
}
